#!/usr/bin/env python
# -*- coding:utf8 -*-
"""
Author : mafei
@Date   : 2019/12/29

"""
from django.http import JsonResponse


def check_login(func):
    def wrapper(self, request, *args, **kwargs):
        print(request.session.keys)
        print(request.session.get("user"))
        if 'user' not in request.session:
            d = {"code": 40, "msg": "还没登录", 'status': 'error'}
            return JsonResponse(d)
        else:
            print("________________________________")
            return func(request, *args, **kwargs)

    return wrapper
